﻿@using Viettel.VOFFICE.Resources
@using Viettel.VOFFICE.Web.Models
<table class="sample-table" width="100%">
    @*    <tr>
        <th>
            
        </th>
        <th>
            
        </th>
        <th>
            
        </th>
        <th>
            
        </th>
        <th>
            
        </th>
    </tr>*@
    @{
        var items = ViewBag.Items as List<LibraryModel>;
        if(items != null && items.Any())
        {

            for(var i = 0; i<items.Count(); i++)
            {
                <tr>
                    <td>
                        @i
                    </td>
                    <td>
                        <span id="form-name-@items[i].Id">@items[i].Name</span>   
                    </td>
                    <td>
                        @items[i].Description
                    </td>
                    <td>
                        @{var submission = items[i].IsSubmission == true ? Resources.SubmissionForm : Resources.DocumentTemplate;}
                        @submission
                    </td>
                    <td>
                        <a href="javascript:void(0);" data-id = "@items[i].Id" style="color:blue;" class="choose-form">@Resources.GridChoose</a>
                    </td>
                </tr>
            }

        }
    }
</table>
<script type="text/javascript">
    $(document).ready(function () {
        var $chooseForm = $('.choose-form');
        $chooseForm.unbind('click');
        $chooseForm.bind('click', function (event) {
            var $target = $(event.currentTarget);
            var id = $target.attr('data-id');
            if (!!id) {
                window.SelectedLibItemId = $target.attr('data-id');
                window.SelectedLibItemName = $('#form-name-' + id).text();
            }
            $('body').trigger('closeSL');
        });
    });
</script>